package edu.ctbu.ljy.bot.webapi;

import edu.ctbu.ljy.bot.Service.impl.TalkService;
import edu.ctbu.ljy.bot.util.ResultUtils;
import edu.ctbu.ljy.bot.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/webapi")
public class TalkRestController {
    @Autowired
    TalkService talkService;

    @GetMapping("/talk")
    public Result<String> talk(@RequestParam(value = "str",defaultValue = "")String str) throws  Exception{
        talkService.talk(str);
        return ResultUtils.success(talkService.res.totalAnswer);
    }


}
